package com.njym.java.security.app.biz;

import com.github.pagehelper.PageHelper;
import com.njym.java.security.app.entity.GroupsMsgContent;
import com.njym.java.security.app.entity.UserMessage;
import com.njym.java.security.app.entity.UserTeacherMessage;
import com.njym.java.security.app.mapper.GroupsMsgContentMapper;
import com.njym.java.security.app.mapper.UserMessageMapper;
import com.njym.java.security.app.mapper.UserTeacherMessageMapper;
import com.njym.java.security.common.biz.BaseBiz;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 
 *
 * @author lijie
 * @email 717057076@qq.com
 * @date 2019-11-22 16:44:11
 */
@Service
public class UserMessageBiz extends BaseBiz<UserMessageMapper,UserMessage> {
    @Resource
    private UserMessageMapper userMessageMapper;
    @Resource
    private UserTeacherMessageMapper userTeacherMessageMapper;
    @Resource
    private GroupsMsgContentMapper groupsMsgContentMapper;

    public int insertMessage(UserMessage userMessage) {
        return userMessageMapper.insertMessage(userMessage);
    }

    public int insertTeacherMessage(UserTeacherMessage userMessage) {
        return userTeacherMessageMapper.insertTeacherMessage(userMessage);
    }

    public int insertGroupMessage(GroupsMsgContent groupsMsgContent) {
        return groupsMsgContentMapper.insertGroupMessage(groupsMsgContent);
    }

    public List<UserMessage> queryHistory(String a, String b, Integer page, Integer limit){
        PageHelper.startPage(page, limit);
        return userMessageMapper.queryHistory(a, b);
    }

    public int countHistory(String a, String b){
        return userMessageMapper.countHistory(a, b);
    }
}